package org.example.demo1.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName CorsConfig
 * @Description 跨域配置
 * @Author Kx
 * @Date 2025/9/9 15:13
 * @Version 1.0
 */
@Configuration
public class CorsConfig implements WebMvcConfigurer {

    /**
     * @author: kx
     * @date: 2025/9/9 15:14
     * @description: 跨域配置
    */
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOriginPatterns("*")
                .allowedMethods("*")
                .allowedHeaders("*")
                .exposedHeaders("*");
    }
}
